package com.jdkreader.concurrency.concurrent.delay;

import java.util.concurrent.ExecutorService;

/**
 * 延时任务结束类
 */
public class EndSentinel extends DelayedTask{

    private ExecutorService exec;

    public EndSentinel(int delay,ExecutorService e){
        super(delay);
        exec=e;
    }


    public void run(){
        for(DelayedTask dt:sequence){
            System.out.println(dt.summary());
        }
        System.out.println();
        System.out.println(this+" Calling shutdownNow()");
        exec.shutdownNow();
    }

}
